﻿<navigation:Page  x:Class="OpenTicket.SilverlightClient.Views.Products" 
          
            Title="Products Page"  
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            
                  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"  
            
                  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
           
                  xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm" 
           
                  xmlns:ria="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls" 
            
                  xmlns:ds="clr-namespace:OpenTicket.Services"
            
                  >
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel Margin="0,12,0,12" Orientation="Vertical" >
            <ria:DomainDataSource x:Name="productDataSource" 
                                  LoadSize="20" 
                                  LoadMethodName="LoadProducts" 
                                  AutoLoad="True">
                <ria:DomainDataSource.DomainContext>
                    <ds:ProductContext/>
                </ria:DomainDataSource.DomainContext>


            </ria:DomainDataSource>

            <data:DataGrid MinHeight="100"  IsReadOnly="True" ItemsSource="{Binding Data, ElementName=productDataSource}"
                x:Name="dataGrid1" />
            <dataControls:DataPager PageSize="5" Source="{Binding Data, ElementName=productDataSource}" Margin="0,-1,0,0"></dataControls:DataPager>


            <dataControls:DataForm x:Name="dataForm1" Header="Products"  AutoGenerateFields="False" AutoCommit="False" CurrentItem="{Binding SelectedItem, ElementName=dataGrid1}" Margin="0,12,0,0">
                <dataControls:DataForm.Fields>
                    <dataControls:DataFormTextField FieldLabelContent="ProductCode ID"  Binding="{Binding ProductCode, Mode=TwoWay }" />
                    <dataControls:DataFormTextField FieldLabelContent="ProductName" Binding="{Binding ProductName, Mode=TwoWay}" />
                    <dataControls:DataFormTextField FieldLabelContent="ProductCost" Binding="{Binding ProductCost, Mode=TwoWay}" />

                </dataControls:DataForm.Fields>
            </dataControls:DataForm>

        </StackPanel>
    </Grid>
</navigation:Page>
